﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Wuliu.SDK.Core.RequestBuilder
{
    public class DeBangUrlBuilder
    {
        private readonly string _host;
        private readonly string _appKey;
        private readonly string _companyCode;


        public DeBangUrlBuilder(string accessKey, string companyCode, string host)
        {
            _appKey = accessKey;
            _companyCode = companyCode;
            _host = host;
        }

        public string Build(string path)
        {
            return path;
        }

        public string Build(string path,string param)
        {
            string time = ToolHelp.getTimeStamp();
            string digest = ToolHelp.GetDigest(param + _appKey + time);

            StringBuilder sb = new StringBuilder();
            sb.Append("digest=" + digest);
            sb.Append("&timestamp=" + time);
            sb.Append("&params=" + param);
            sb.Append("&companyCode=" + _companyCode);
            return path + "?" + sb.ToString();
        }
    }
}
